import os, sys
from robofab import RoboFabError, version, numberVersion


class RFWorld:

	"""All parameters about platforms, versions and environments included in one object."""

	def __init__(self):
		self.applicationName = None # name of the application we're running in
		self.name = os.name
		self.version = version # the robofab version
		self.numberVersion = numberVersion
		self.run = True

		# collect versions
		self.pyVersion = sys.version[:3]
		self.inPython = False 
		self.inGlyphs = False
		self.glyphsVersion = None

		from AppKit import NSBundle
		bundle = NSBundle.mainBundle()
		self.applicationName = bundle.infoDictionary()["CFBundleName"]
		self.inGlyphs = True
		self.glyphsVersion = bundle.infoDictionary()["CFBundleVersion"]

	def __repr__(self):
		s = [
			"Python version: %s" % self.pyVersion,
			"Glyphs stuff: %s" % self.inGlyphs,
			"Glyphs version: %s" % self.glyphsVersion,
		]
		return ", ".join(s)

world = RFWorld()

lineBreak = os.linesep

from objectsGS import CurrentFont, CurrentGlyph, RFont, RGlyph, OpenFont, NewFont, AllFonts

if __name__ == "__main__":
	f = RFWorld()
	print(f)
